#!############################################################################
#!
#! This is a tmake template for creating a makefile that invokes make in
#! sub directories - for Win32.
#!
#${
    $project{ "SUBDIRS"} =~ s-/-\\-g;
    $m = "";
    foreach ( split(/\s+/, Project("SUBDIRS")) ) {
        my $cdup = "cd .." . "\\.." x m-\\-;
        $m = $m . "\tcd $_\n\tDOMAKE\n\t\@$cdup\n";
    }
    $project{"SUBMAKE"} = $m;
    Project('MAKEFILE') || Project('MAKEFILE = Makefile');
    Project('TMAKE') || Project('TMAKE = tmake');
#$}
#!
#! Makefile for building targets in sub directories.
#! Generated by tmake at #$ Now();
#!     Project: #$ Expand("PROJECT");
#!    Template: #$ Expand("TEMPLATE");
#!############################################################################
#!TMAKE   =   #$ Expand("TMAKE");
MAKEFILE=   #$ Expand("MAKEFILE");
SUBDIRS =   #$ ExpandList("SUBDIRS");

all: $(SUBDIRS)

#${
    foreach ( split(/\s+/,$project{"SUBDIRS"}) ) {
        my $cdup = "cd .." . "\\.." x m-\\-;
        if ( Project("TMAKE_NOFORCE") ) {
            $text = $text . $_ . ":\n\t" .
            "cd $_\n\t\$(MAKE\) -f \$(MAKEFILE)\n\t\@$cdup\n\n";
        } else {
            $text = $text . $_ . ": FORCE\n\t" .
            "cd $_\n\t\$(MAKE\) -f \$(MAKEFILE)\n\t\@$cdup\n\n";
        }
    }
#$}
CONFIGURE_TARGET = #$ $text = Project("AUTOCONF_T_INCLUDED") ? "" : "configure";
CLEANFILES       = #$ Expand("CLEANFILES");
CLEANDIRS        = #$ Expand("CLEANDIRS");

install test pkg install_only $(CONFIGURE_TARGET): FORCE
#$ $text = $project{"SUBMAKE"}; $text =~ s/DOMAKE/\$(MAKE\) -f \$(MAKEFILE) \$@/g;

clean: FORCE
#$ $text = $project{"SUBMAKE"}; $text =~ s/DOMAKE/\$(MAKE\) -f \$(MAKEFILE) \$@/g;
#$ Project("CLEANFILES") and $text = "\tdel /q \$(CLEANFILES)";
#$ Project("CLEANDIRS") and $text = "\trd /q /s \$(CLEANDIRS)";

#$ Project("TMAKE_NOFORCE") && DisableOutput();
FORCE:
#$ Project("TMAKE_NOFORCE") && EnableOutput();
